package com.sdx.console.banner.service;

import java.util.List;

import com.ibeetl.admin.core.entity.BaseEntity;
import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.banner.dao.BaseBannerDao;
import com.sdx.console.banner.entity.BaseBanner;
import com.ibeetl.admin.core.service.BaseService;

/**
 * banner Service
 */

@Service
@Transactional
public class BaseBannerService extends BaseService<BaseBanner>{

    @Resource
	private BaseBannerDao bannerDao;

    public PageQuery<BaseBanner>queryByCondition(PageQuery query){
        PageQuery ret =  bannerDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelBaseBanner(List<String> ids){
        try {
            bannerDao.batchDelBaseBannerByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除banner失败", e);
        }
    }

	public List<BaseBanner> all() {
		return bannerDao.all();
		}

    public List<BaseEntity> selectSaleProduct(){
        return bannerDao.selectSaleProduct();
    }
}